package com.bupt.websocket.utils;

import com.bupt.websocket.service.impl.WebPush;
import com.jyt.message.Message;
import com.jyt.util.MySerializable;

/**
 * Created by ikariyui on 2018/3/25.
 */
public class IkariUtils {
    public static boolean sendViWebPush(String from, String to, String type, String content){

        Message message = new Message();
        message.setContent(MySerializable.object_bytes(content));
        message.setFrom(from);
        message.setTo(to);
        message.setType(type);

        ClientWeb clientWeb = WebPush.clients2.get(from);
        if(null!=clientWeb){
            clientWeb.send(message);
            return true;
        }
        return false;
    }
}
